package com.example.pet.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

import java.util.ArrayList;

@Configuration
public class SwaggerConfig {
@Bean
    public Docket createRestApi(){
    return new Docket(DocumentationType.OAS_30)
            .groupName("java")
            .enable(true)
            .select()
            .apis(RequestHandlerSelectors.basePackage("com.example.pet.controller"))
            .build()
            .apiInfo(createRestApiInfo());
}

    private ApiInfo createRestApiInfo() {
        return new ApiInfo("Api Documentation",
                "Api Documentation",
                "1.0",
                "urn:tos",
                new Contact("java岗位2班","https://www.baidu.com/","2945423824@qq.com"),
                "Apache 2.0",
                "http://www.apache.org/licenses/LICENSE-2.0",
                new ArrayList());

    }
}
